package com.ruoyi.web.controller.school;


import com.ruoyi.common.core.controller.BaseController;
import com.ruoyi.common.core.domain.AjaxResult;
import com.ruoyi.common.core.domain.entity.SysUser;
import com.ruoyi.student.domain.vo.SelectListVo;
import com.ruoyi.system.service.ISysUserService;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.ArrayList;
import java.util.List;


/**
 * 辅导员相关
 */
@RestController
@RequestMapping("/school/counsellor")
public class CounsellorController extends BaseController {


    @Resource
    private ISysUserService userService;


    /**
     * 查询辅导员下拉列表
     */
    @GetMapping("/selectlist")
    public AjaxResult selectlist() {
        SysUser user = new SysUser();
        user.setDelFlag("0");
        user.setStatus("0");
        List<SysUser> query = userService.selectUserList(user);
        List<SelectListVo> list = new ArrayList<>();
        for (SysUser data : query) {
            SelectListVo dto = new SelectListVo();
            dto.setLabel(data.getNickName()); //用户姓名
            dto.setValue(data.getUserName()); //用户账号
            dto.setExt(data.getRemark());//备注
            list.add(dto);
        }
        return success(list);
    }

}
